home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
MATHEMAT
/
1769.ZIP
/
ALGIN2
< prev
next >
Wrap
Text File
|
1987-02-21
|
758b
|
27 lines
order x y z
* This example contains a procedure which computes factorials.
* The lines from "procedure factorial" to "return" define the
* procedure. There is no provision for local variables or
* sums in procedures. The sum "facarg" is used to
* transmit the argument, and the sum "facans" is used to
* transmit the answer.
procedure factorial
np=0 ;After this command only error messages are printed.
define one=1
define facans=one
if facarg.eq.one goto facend
define temp=facarg
if temp.lt.one bomb
label fact1
compute facans=facans*temp
compute temp=temp-one
if temp.ne.one goto fact1
label facend
np=2 ;after this command the usual printing resumes
return
define facarg=5
call factorial
print facans
end input